package com.learn.aop.service.impl;

import com.learn.aop.annotation.SysLog;
import com.learn.aop.dto.TestDomain;
import com.learn.aop.service.LogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class LogServiceImpl implements LogService {

    @SysLog("log-1")
    @Override
    public void log1(String name, TestDomain testDomain) {
        System.out.println("print log 1" + name + " " + testDomain.toString());
    }

    @SysLog("log-2")
    @Override
    public void log2(String name, TestDomain testDomain) {
        System.out.println("print log 2" + name + " " + testDomain.toString());
    }


    @SysLog("throw-exception")
    @Override
    public void throwException() {
        System.out.println("throw exception");
        int i = 3 / 0;
    }

    @Override
    public void log(long beginTime, String s) {
        log.info("s:{},beginTime:{}", s, beginTime);
    }
}
